{% extends 'stark/layout.html' %}
{% load my_tag %}

{% block css %}
    <style>
        tr.active {
            border-left: 3px solid #fdc00f;
        }
    </style>
{% endblock %}

{% block content %}

<div class="col-md-3">
    <div class="bs-example" data-example-id="table-within-panel">
    <div class="panel panel-default">
      <!-- Default panel contents -->
      <div class="panel-heading">
        <i class="fa fa-folder-open" aria-hidden="true"></i> 一级菜单
        <a href="{% custom_url request 'rbac_menu_add' %}" class="btn btn-success btn-xs" style="padding: 2px 8px; margin: -3px; float: right">
            <i class="fa fa-plus-circle" aria-hidden="true"></i>
            新建
        </a>
      </div>

      <!-- Table -->
      <table class="table">
        <thead>
          <tr>
            <th>名称</th>
            <th>图标</th>
            <th>选项</th>
          </tr>
        </thead>
        <tbody>
          {% for row in menu_list %}
          <tr class="{% if row.id == menu_id %}active{% endif %}">
            <td>
                <a href="?mid={{ row.id }}">{{ row.title }}</a>
            </td>
            <td>
                <i class="{{ row.icon }}" aria-hidden="true"></i>
            </td>
            <td>
                <a style="color: #333333;" href="{% custom_url request 'rbac_menu_edit' mid=row.id %}">
                    <i class="fa fa-edit" aria-hidden="true">
                    </i>
                </a>
                <a style="color: #d9534f;" href="{% custom_url request 'rbac_menu_del' mid=row.id %}">
                    <i class="fa fa-trash-o">
                    </i>
                </a>
            </td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
</div>
</div>

<div class="col-md-4">
    <div class="bs-example" data-example-id="table-within-panel">
    <div class="panel panel-default">
      <!-- Default panel contents -->
      <div class="panel-heading">
        <i class="fa fa-folder-open" aria-hidden="true"></i> 二级菜单
        {% if menu_id %}
        <a href="{% custom_url request 'rbac_menu_add_sec' menu_id=menu_id %}" class="btn btn-success btn-xs" style="padding: 2px 8px; margin: -3px; float: right">
            <i class="fa fa-plus-circle" aria-hidden="true"></i>
            新建
        </a>
        {% endif %}
      </div>

      <!-- Table -->
      <table class="table">
        <thead>
          <tr>
            <th>名称</th>
            <th>name&URL</th>
            <th>选项</th>
          </tr>
        </thead>
        <tbody>
          {% for row in per_list %}
          <tr class="{% if sec_menu_id == row.id %}active{% endif %}">
            <td rowspan="2">
                <a href="?mid={{ menu_id }}&sid={{ row.id }}">{{ row.title }}</a>
            </td>
            <td>{{ row.name }}</td>
            <td>
                <a style="color: #333333;" href="{% custom_url request 'rbac_menu_edit_sec' smid=row.id %}">
                    <i class="fa fa-edit" aria-hidden="true">
                    </i>
                </a>
                <a style="color: #d9534f;" href="{% custom_url request 'rbac_menu_del_sec' smid=row.id %}">
                    <i class="fa fa-trash-o">
                    </i>
                </a>
            </td>
          </tr>
          <tr class="{% if sec_menu_id == row.id %}active{% endif %}">
            <td colspan="2" style="border-top: 0">{{ row.url }}</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
</div>
</div>

<div class="col-md-4">
    <div class="bs-example" data-example-id="table-within-panel">
    <div class="panel panel-default">
      <!-- Default panel contents -->
      <div class="panel-heading">
        <i class="fa fa-folder-open" aria-hidden="true"></i> 权限
        {% if sec_menu_id %}
        <a href="{% custom_url request 'rbac_per_add' sec_menu_id=sec_menu_id %}" class="btn btn-success btn-xs" style="padding: 2px 8px; margin: -3px; float: right">
            <i class="fa fa-plus-circle" aria-hidden="true"></i>
            新建
        </a>
        {% endif %}
        <a href="{% url 'rbac_multi_permissions' %}" class="btn btn-xs btn-primary" style="padding: 2px 8px;margin: -3px 0;">
            <i class="fa fa-mail-forward" aria-hidden="true"></i>
            批量操作
        </a>
      </div>

      <!-- Table -->
      <table class="table">
        <thead>
          <tr>
            <th>名称</th>
            <th>name&URL</th>
            <th>选项</th>
          </tr>
        </thead>
        <tbody>
          {% for row in chi_per_list %}
          <tr>
            <td rowspan="2">{{ row.title }}</td>
            <td>{{ row.name }}</td>
            <td>
                <a style="color: #333333;" href="{% custom_url request 'rbac_per_edit' pid=row.id %}">
                    <i class="fa fa-edit" aria-hidden="true">
                    </i>
                </a>
                <a style="color: #d9534f;" href="{% custom_url request 'rbac_per_del' pid=row.id %}">
                    <i class="fa fa-trash-o">
                    </i>
                </a>
            </td>
          </tr>
          <tr>
            <td colspan="2" style="border-top: 0">{{ row.url }}</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
</div>
</div>

{% endblock %}